package com.ss.android.common.download;

import android.content.Context;

import com.ss.android.common.ad.MobAdClickCombiner;

import org.json.JSONObject;

public final class g {
    private Context a;

    public g(Context arg2) {
        this.a = arg2.getApplicationContext();
    }

    public final void a(long arg12, int arg14) {
        int v7 = 2;
        Context v1 = this.a;
        if (v1 != null) {
            String v3 = "";
            switch (arg14) {
                case 1: {
                    v3 = "download_finish";
                    break;
                }
                case 2: {
                    v3 = "click_open";
                    break;
                }
                case 3: {
                    v3 = "click_install";
                    break;
                }
                case 4: {
                    v3 = "install_finish";
                    break;
                }
            }

            try {
                String v0_1 = DownloadAdapterProxy.inst().getDownloadExtra(v1, arg12);
                if (android.support.design.a.isTextEmpty(v0_1)) {
                    return;
                }

                String v2 = null;
                String[] v0_2 = v0_1.split("##");
                String v4 = v0_2[0];
                if (v0_2.length > 1) {
                    switch (Integer.parseInt(v0_2[1])) {
                        case 1: {
                            v2 = "feed_download_ad";
                            break;
                        }
                        case 2: {
                            v2 = "detail_download_ad";
                            break;
                        }
                        case 3: {
                            v2 = "comment_download_ad";
                            break;
                        }
                        case 4: {
                            v2 = "wap";
                            break;
                        }
                        case 6: {
                            v2 = "detail_download_ad";
                            break;
                        }
                        case 7: {
                            v2 = "feed_download_ad";
                            break;
                        }
                    }


                }
                JSONObject v8 = new JSONObject();
                if (v0_2.length > v7) {
                    v0_1 = v0_2[2];
                    if (!android.support.design.a.isTextEmpty(v0_1)) {
                        v8.put("log_extra", v0_1);
                    }
                }

                MobAdClickCombiner.onAdEvent(v1, v2, v3, Long.parseLong(v4), 0, v8, 0);
            } catch (Exception v0) {
                v0.printStackTrace();
            }
        }
    }
}

